import 'dart:convert';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_chip/config/Routers.dart';
import 'package:flutter_chip/utils/sp_utils.dart';
import 'package:flutter_chip/utils/third_utils.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

class Comm {
  ///QQ参数
  static const QQ_APPID = "1109241687";
  static const QQ_APPKEY = "3xpxXkUW6ErUx3hq";

  ///微信参数
  static const WX_APPID = "wx506401e5fcb708df";
  static const WX_APPSERCET = "6d748e042f694e5bde0a5afc1c4541de";

  ///支付宝参数
  static const ALI_APPID = "2019110368912013";

  ///高德地图key
  static const AMAP_IOSKEY = "49bfb3d3f9af6270028f42fda43d5885";

  ///图片资源
  static const IMG_USER_BG = 'images/user_bg.jpg';
  static const IMG_NO_DATA = 'images/no_data.png';
  static const IMG_DEFAULT = 'images/default_user.png';
  static const IMG_APP_LOGO = 'images/app_logo.png';
  static const IMG_UPDATE_BG = 'images/update_bg.png';
  static const IMG_QR_SCAN = 'images/qr_scan.png';
  static const IMG_ORDER = 'images/my_order.png';
  static const IMG_SALE = 'images/my_sale.png';
  static const IMG_COLLECT = 'images/my_collect.png';
  static const IMG_ARROW_RIGHT = 'images/arrow_right.png';
  static const IMG_QR_CODE = 'images/qr_code.png';
  static const IMG_IC_VIP = 'images/ic_vip.png';
  static const IMG_V_EDIT = 'images/ic_edit.png';
  static const IMG_V_MARK = 'images/ic_mark.png';
  static const IMG_V_MM = 'images/ic_mm.png';
  static const IMG_V_BG = 'images/ic_vbg.png';
  static const IMG_PROFIT = 'images/ic_profit.png';
  static const IMG_TOPIC = 'images/ic_topic.png';
  static const IMG_SHZ = 'images/status_shz.png';
  static const IMG_YBH = 'images/status_ybh.png';
  static const IMG_YFB = 'images/status_yfb.png';
  static const IMG_YXJ = 'images/status_yxj.png';
  static const IMG_CONTACT = 'images/ic_contact.png';
  static const IMG_PAYSUCCESS = 'images/ic_pay_success.png';
  static const IMG_DEL = 'images/comm_del.png';
  static const IMG_EDIT = 'images/comm_edit.png';
  static const IMG_LAUNCH = 'images/launch_image.jpg';
  static const IMG_YING = 'images/ying.png';
  static const IMG_YANG = 'images/yang.png';

  static const ASM_INFO =
      '符号 含义：\n1、Rn R0～R7寄存器n=0～7。\n2、Direct 直接地址,内部数据区的地址RAM(00H～7FH)。\n3、SFR(80H～FFH) B,ACC,PSW,IP,P3,IE,P2,SCON,P1,TCON,P0。\n4、@Ri 间接地址Ri=R0或R1;8051/31RAM地址(00H～7FH);8052/32RAM地址(00H～FFH)。\n5、#data 8位常数。\n6、#data16 16位常数。\n7、Addr16 16位的目标地址。\n8、Addr11 11位的目标地址。\n9、Rel 相关地址。\n10、bit 内部数据RAM(20H～2FH),特殊功能寄存器的直接地址的位';

  static var screenWidth;
  static var screenHeight;

  static var versionName;
  static var appName;
  static var buildNumber;

  static bool isLogin = false;
  static String userId;

  ///当前定位城市
  static var province;
  static var city;
  static var district;
  static const Map<String, String> courseMap = {
    "MCU": "单片机教程",
    "ASM": "汇编教程",
    "ORDER": "汇编指令",
    "C": "C语言教程",
    "C_FUNC": "C函数库",
    "C_SORT": "C排序算法",
  };

  ///蓝牙助手按键配置
  static const Map<String, String> bleMap = {
    "dir_up": "FF00",
    "dir_down": "FF01",
    "dir_left": "FF02",
    "dir_right": "FF03",
    "dir_center": "FF04",
    "dir_label": "OK",
    "label_recv1": "接收数据1：",
    "recv_start1": "&",
    "recv_end1": "&",
    "label_recv2": "接收数据2：",
    "recv_start2": "#",
    "recv_end2": "#",
    "label_1": "功能1",
    "label_2": "功能2",
    "label_3": "功能3",
    "label_4": "功能4",
    "label_5": "功能5",
    "label_6": "功能6",
    "label_7": "功能7",
    "label_8": "功能8",
    "label_9": "功能9",
    "send_1": "FF11",
    "send_2": "FF12",
    "send_3": "FF13",
    "send_4": "FF14",
    "send_5": "FF15",
    "send_6": "FF16",
    "send_7": "FF17",
    "send_8": "FF18",
    "send_9": "FF19",
  };

  static const Map<String, dynamic> iconMap = {
    'memory': Icons.memory,
    'event': Icons.event,
    'pie_chart_outlined': Icons.pie_chart_outlined,
    'computer': Icons.computer,
    'map': Icons.map,
    'bookmark_border': Icons.bookmark_border,
    'bluetooth': Icons.bluetooth,
    'wifi': Icons.wifi,
    'more_horiz': Icons.more_horiz,
    'filter_8': Icons.filter_8,
    'usb': Icons.usb,
    'calculator': FontAwesomeIcons.calculator,
  };

  ///全部工具类
  static const List<Map<String, dynamic>> allToolTabs = [
    {
      'title': '单片机教程',
      'color': 0xff05C795,
      'icon': 'memory',
      'path': '${Routers.PAGE_HOME_CMCU}?type=MCU'
    },
    {
      'title': 'C语言教程',
      'color': 0xff09B2B9,
      'icon': 'event',
      'path': '${Routers.PAGE_HOME_CC}?type=C'
    },
    {
      'title': 'C函数库',
      'color': 0xffFBA213,
      'icon': 'pie_chart_outlined',
      'path': '${Routers.PAGE_HOME_CC}?type=C_FUNC'
    },
    {
      'title': '汇编指令',
      'color': 0xff4A56FA,
      'icon': 'computer',
      'path': '${Routers.PAGE_HOME_CMCU}?type=ORDER'
    },
    {
      'title': '汇编教程',
      'color': 0xffFB3453,
      'icon': 'map',
      'path': '${Routers.PAGE_HOME_CMCU}?type=ASM'
    },
    {
      'title': 'C排序算法',
      'color': 0xff2674E7,
      'icon': 'bookmark_border',
      'path': '${Routers.PAGE_HOME_CC}?type=C_SORT'
    },
    {
      'title': '蓝牙遥控',
      'color': 0xff0482FB,
      'icon': 'bluetooth',
      'path': '${Routers.PAGE_HOME_BLUE}'
    },
    {
      'title': '网络助手',
      'color': 0xff86DB49,
      'icon': 'wifi',
      'path': '${Routers.PAGE_HOME_WIFI}'
    },
    {
      'title': '数码管',
      'color': 0xff29DB6F,
      'icon': 'filter_8',
      'path': '${Routers.PAGE_HOME_LED}'
    },
    {
      'title': '串口助手',
      'color': 0xff2E3F5D,
      'icon': 'usb',
      'path': '${Routers.PAGE_HOME_SERIAL}'
    },
    {
      'title': '进制计算器',
      'color': 0XFFD8952F,
      'icon': 'calculator',
      'path': '${Routers.PAGE_HOME_CALCULATOR}'
    }
  ];
}
